#pragma GCC optimize(2)
#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
#include <bitset>
#define F first
#define S second
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int N=2e5+10;
ll a[N];
ll b[N];
void solve()
{
	ll n,m,d;
	cin>>n>>m>>d;
	for(int i=1;i<=m;i++) cin>>a[i];
	for(int i=0;i<=m+1;i++) b[i]=0;
	a[0]=1;
	a[m+1]=n;
    int lpos=1;
    ll len=0;
    ll cnt=1;
	for(int i=1;i<=m;i++)
	{
		if((a[i]-lpos)%d!=0)
		{
			len=a[i]-lpos-1;
			cnt=cnt+1+len/d;
		}
		else
		{
			len=a[i]-lpos;
			cnt=cnt+len/d;
		}
		lpos=a[i];
	}
	cnt=cnt+(n-a[m])/d;
//	cout<<cnt<<endl;
	lpos=1;
	for(int i=1;i<=m;i++)
	{
		if(a[i]==1) continue;
		len=a[i+1]-a[i-1]-1;
		int num1=len/d;
		int num2=(a[i]-a[i-1]-1)/d+1+(a[i+1]-a[i]-1)/d;
		b[i]=num2-num1;
//		cout<<b[i]<<' ';
	}
	len=a[m+1]-a[m-1];
	ll num1=len/d;
//	cout<<len<<endl;
	ll num2=(a[m]-a[m-1]-1)/d+1+(a[m+1]-a[m])/d;
	b[m]=num2-num1;
	
	ll ans=0;
	for(int i=1;i<=m;i++)
	{
//		cout<<b[i]<<' ';
		ans=max(ans,b[i]);
	}
	ll res=0;
	for(int i=1;i<=m;i++)
	{
		if(b[i]==ans) res++;
	}
	cout<<cnt-ans<<' '<<res<<endl;
}
int main()
{
	IOS;
	int T=1;
	cin>>T;

	while(T--)
	{
		solve();
	}

	return 0;
}

